package cn.com.libertymutual.core.database.druid.servlet;

import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;

///@Configuration
///@EnableTransactionManagement
public class DruidSourceConfiguration implements EnvironmentAware {
	

	@Override
	public void setEnvironment(Environment env) {
		///this.propertyResolver = new PropertySourcesPlaceholdersResolver(env, "spring.datasource.druid.");
		
	}

	/**
	 * ServletRegistrationBean,
	 * @see com.alibaba.druid.support.http.ResourceServlet
	 * @return
	 */
	/*@Bean
	public ServletRegistrationBean statViewServlet() {
		ServletRegistrationBean druid = new ServletRegistrationBean();
		druid.setServlet(new StatViewServlet());
		druid.setUrlMappings(Arrays.asList(propertyResolver.getProperty("urlPatterns", "/druid/*")));
		
		Map<String,String> params = new HashMap<>();
		
		params.put("loginUsername", propertyResolver.getProperty("loginUsername", ""));
		params.put("loginPassword", propertyResolver.getProperty("loginPassword", ""));
		
		//params.put("allow", propertyResolver.getProperty("allow", "127.0.0.1,10.132.28.243"));
		//params.put("deny", propertyResolver.getProperty("deny", ""));
		params.put("resetEnable", propertyResolver.getProperty("resetEnable", "false"));
		
		druid.setInitParameters(params);

		return druid;
	}*/

	
}
